package cn.openea.perpartner.componet.web.enums;

import cn.openea.perpartner.componet.constant.CommonConstants;
import cn.openea.perpartner.componet.web.entity.dto.ImportSmsBlacklistDTO;
import cn.openea.perpartner.componet.web.service.importandexport.ImportAndExportService;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

/**
 * @author ysk
 * @version 1.0.1
 * @Description 导入导出动作
 * @createTime 2023年05月15日 16:21:00
 */
@Getter
public enum ImportAndExportActions {

    /**
     * 导入短信黑名单
     */
    IMPORT_SMS_BLACKLIST(CommonConstants.IMPORTANDEXPORT.IMPORT_SMS_BLACKLIST,"导入短信黑名单", ImportSmsBlacklistDTO.class),
    ;

    /**
     * 动作编码
     */
    private final String code;

    /**
     * 备注
     */
    private final String remark;

    /**
     * 模板类型
     */
    private final Class tClass;

    ImportAndExportActions(String code, String remark, Class tClass) {
        this.code = code;
        this.remark = remark;
        this.tClass = tClass;
    }

    public static ImportAndExportActions getByCode(String code) {
        if (StringUtils.isBlank(code)) {
            return null;
        }
        for (ImportAndExportActions value : values()) {
            if (code.equals(value.getCode())) {
                return value;
            }
        }
        return null;
    }
}
